/*--------------------------------------------------------------------------------*/
#ifndef __GRAPHIC_ATLAS_RENDERER__
#define __GRAPHIC_ATLAS_RENDERER__
/*--------------------------------------------------------------------------------*/
#include "primitives.h"
#include "object.h"
#include "util.h"
#include "graphic_texture_set.h"
/*--------------------------------------------------------------------------------*/
class GRAPHIC_ATLAS_RENDERER : public OBJECT
{

	// -- PUBLIC

public:

	// .. TYPES

	struct VERTEX
	{
		MATH_VECTOR_2
			Position,
			UV;
	};

    DECLARE_REF( GRAPHIC_ATLAS_RENDERER );

    // .. CONSTRUCTORS

    GRAPHIC_ATLAS_RENDERER()
    	: OBJECT(), Atlas(), VertexTable()
    {

    }

    ~GRAPHIC_ATLAS_RENDERER()
    {
     
    }

    // .. ACCESSORS


    VOID SetAtlas( const GRAPHIC_ATLAS::REF & atlas )
    {
    	Atlas = atlas;
    }

    const GRAPHIC_ATLAS & GetAtlas() const
    {
    	return *Atlas;
    }

    // .. METHODS

    VOID Clear();

    VOID ReserveQuads( const COUNT count );

    VOID AddQuad( const MATH_VECTOR_2 & position, const MATH_VECTOR_2 & extent, INT texture_id, REAL angle = 0.0f );

    VOID Render();

    // -- PRIVATE

private :

    // .. ATTRIBUTES

    GRAPHIC_ATLAS::REF
    	Atlas;
    ARRAY< VERTEX >
    	VertexTable;
    
};
/*--------------------------------------------------------------------------------*/
#endif
